<template>
	<el-container>
		<el-aside width="220px">
			<el-tree ref="category" class="menu" node-key="label" :data="category" :default-expanded-keys="['系统日志']" current-node-key="系统日志" :highlight-current="true" :expand-on-click-node="false">
			</el-tree>
		</el-aside>
		<el-container>
			<el-main class="nopadding">
				<el-container>
					<el-header>
						<div class="left-panel">
							<el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
						</div>
						<div class="right-panel">

						</div>
					</el-header>
					<el-main class="nopadding">
						<scTable ref="table" :api-obj="apiObj" stripe highlightCurrentRow @row-click="rowClick">
							<el-table-column label="请求接口" prop="operationPath" width="300"></el-table-column>
							<el-table-column label="API分组" prop="apiGroup" width="170"></el-table-column>
							<el-table-column label="操作账号" prop="operationAccount" width="150"></el-table-column>
							<el-table-column label="操作用户" prop="operationUser" width="150"></el-table-column>
							<el-table-column label="客户端IP" prop="operationIp" width="150"></el-table-column>
							<el-table-column label="操作时间" prop="operationTime" width="170"></el-table-column>
							<el-table-column label="API描述" prop="operationDesc" width="170"></el-table-column>
						</scTable>
					</el-main>
				</el-container>
			</el-main>
		</el-container>
	</el-container>

	<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
		<info ref="info"></info>
	</el-drawer>
</template>

<script>
	import info from './info'
	import scEcharts from '@/components/scEcharts'

	export default {
		name: 'log',
		components: {
			info,
			scEcharts
		},
		data() {
			return {
				apiObj: this.$API.system.OperationLog.GetAllOperationLogList,
				infoDrawer: false,
				category: [
					{
						label: '系统日志',
						children: [
							{label: 'debug'},
							{label: 'info'},
							{label: 'warn'},
							{label: 'error'},
							{label: 'fatal'}
						]
					},
					{
						label: '应用日志',
						children: [
							{label: 'selfHelp'},
							{label: 'WechatApp'}
						]
					}
				],
				date: [],
				search: {
					keyword: ""
				}
			}
		},
		methods: {
			upsearch(){

			},
			rowClick(row){
				this.infoDrawer = true
				this.$nextTick(() => {
					this.$refs.info.setData(row)
				})
			},
			async getAllOperationLog(){
				let res = await this.$API.system.OperationLog.GetAllOperationLogList.get()
				this.date = res.data.operationLogList
			}
		},
		created() {
			// this.getAllOperationLog()
		}
	}
</script>

<style>
</style>
